<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
	<base href="${pageContext.request.contextPath}/"></base>
	<title>毕业设计项目</title>
	<meta charset="utf-8">
	<link href="css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript"  src="js/jquery-2.2.3.js"></script>
	<script src="script/common.js"></script>

	<script >
        $(function(){
            atvCustNo = $("#atvCustNo").val().trim()+"";
             atvCustName = $("#atvCustName").val().trim()+"";
            function addData() {

                if(atvCustNo =="" || atvCustName==""){
                    alert("添加失败")
				}else{
                    var a= $("input[name=T1]").val().trim();
                    var b=  $("input[name=T2]").val().trim();
                    var c=  $("input[name=T3]").val().trim();
                    var d= $("input[name=T4]").val()+"";
                    var e=  $("textarea[name=s1]").text()+"";
                    if(a=="" || a==null){
                        alert("日期必需填写")
                        return ;
                    }else  if(b=="" || b==null){
                        console.log(333333333)
                        alert("地点必需填写")
                        return ;
                    }else if (c=="" || c==null){
                        alert("概要必需填写")

                    }else{
                        addActivities({"atvCustNo":atvCustNo,"atvCustName":atvCustName,"atvDate":a,"atvPlace":b,"atvTitle":c,"atvDesc":d,"atvRemark":e})
                    }
				}



            };
            $("#addActivity").click(function(){
                addData();
            })
            function addActivities(atvId) {
                $.ajax({
                    type:"post",
                    url:"/CusterRelSys/CstActivity/addActivites",
                    data:atvId,
                    success:function(Activities){
                        if(Activities==1){
                            alert("添加成功")
                        }else{
                            alert("添加失败")
                        }
                        window.location.href=('~cust/cust/activities.jsp?atvCustNo='+atvCustNo+"&atvCustName="+atvCustName);

                    },error:function(){
                        alert("添加失败")
                        window.location.href=('~cust/cust/activities.jsp?atvCustNo='+atvCustNo+"&atvCustName="+atvCustName);
                    }
                });
            }
        })
	</script>
</head>
<body>
<input type="hidden" id="atvCustNo" value="<%=request.getParameter("atvCustNo")%>">
<input type="hidden" id="atvCustName" value="<%=request.getParameter("atvCustName")%>">
<div class="page_title">客户信息管理 > 客户信息 > 交往记录 > 新建交往记录</div>
<div class="button_bar">
	<button class="common_button" onclick="help('');">帮助</button>
	<button class="common_button" onclick="back();">返回</button>
	<button class="common_button" id="addActivity">保存</button>  
</div>
<table class="query_form_table">
	<tr>
		<th>时间</th>
		<td><input name="T1" /><span class="red_star">*</span></td>
		<th>地点</th>
		<td>
			<input name="T2" size="20" /><span class="red_star">*</span></td>
	</tr>
	<tr>
		<th>概要</th>
		<td><input name="T3"/><span class="red_star">*</span></td>
		<th>备注</th>
		<td><input name="T4" /></td>
	</tr>	
	<tr>
		<th>详细信息</th>
		<td colspan="3">
			<textarea name="S1" cols="50" rows="6"> </textarea>
		</td>
	</tr>
</table>
</body>
</html>